package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppRepairTaskMapper;
import com.ep.modules.app.entity.AppRepairTask;
import com.ep.modules.app.entity.AppRepairTaskExample;
import com.ep.modules.app.service.AppRepairTaskService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppRepairTaskServiceImpl implements AppRepairTaskService {
    @Autowired
    private AppRepairTaskMapper appRepairTaskMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppRepairTaskExample example = new AppRepairTaskExample();
        AppRepairTaskExample.Criteria criteria = example.createCriteria();
        List<AppRepairTask> list = appRepairTaskMapper.selectByExample(example);
        Page<AppRepairTask> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppRepairTask getById(Long id) {
        return appRepairTaskMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppRepairTask entity) {
        appRepairTaskMapper.insert(entity);
    }

    public void update(AppRepairTask entity) {
        appRepairTaskMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appRepairTaskMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}